<html
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:composite="http://java.sun.com/jsf/composite"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <composite:interface>
        <composite:attribute name="header" />
    </composite:interface>

    <composite:implementation>
        <h:outputScript library="scripts" name="jquery.min.js" />
        <h:outputScript library="scripts" name="spinner.js" />
        <h:outputStylesheet library="css" name="spinner.css" />

        <div id="boxes">
            <div id="dialog">
                <h:graphicImage library="images" name="ajax-loader.gif" />
            </div>
            <!-- Do not remove div#mask, because you'll need it to fill the whole screen -->
            <div id="mask"></div>
            <div id="mask-black"></div>
        </div>

        <div id="top">
            <div id="logo">
                <a href="#{request.contextPath}/index.html"><img src="#{request.contextPath}/resources/images/logo.png" alt="logo" title="Logo" /></a>
            </div>

            <div id="top-menu-container">
                <div id="login-menu">
                    <c:if test="#{userManager.loggedIn}">
                        <h:outputStylesheet library="css" name="#{facesContext.externalContext.requestLocale.language}-userLoginMenu.css" />
                        <ul>
                            <c:choose>
                                <c:when test="#{facesContext.externalContext.requestServletPath == '/main.jsf'}" >
                                    <li><h:form><h:commandLink id="logoutLoginMenuLogout" action="#{userManager.logout}" styleClass="logout" /></h:form></li>
                                </c:when>
                                <c:when test="#{facesContext.externalContext.requestServletPath == '/register.jsf'}" >
                                    <li><h:form><h:commandLink id="logoutLoginMenuLogout" action="#{userManager.logout}" styleClass="logout" /></h:form></li>
                                </c:when>
                                <c:otherwise>
                                    <li><h:commandLink id="logoutLoginMenuLogout" action="#{userManager.logout}" styleClass="logout" /></li>
                               </c:otherwise>
                            </c:choose>
                            <li><a href="#{request.contextPath}/user/settings.jsf" class="settings"></a></li>
                            <li style="margin-right: 1em; font-weight: bold;"><ui:insert name="login-username">#{userManager.user.name} (#{userManager.user.login})</ui:insert></li>
                        </ul>
                    </c:if>
                </div>

                <c:if test="#{userManager.loggedIn == false}">
                    <div id="login-menu">
                    <ul>
                        <li><ui:insert name="login-username">
                                <a href="#{request.contextPath}/user/main.jsf">#{msgs["login.login"]}</a>
                            </ui:insert>
                        </li>
                    </ul>
                    </div>
                </c:if>
                

                <hr class="cleaner" />

                <div id="main-menu">
                    <c:if test="#{userManager.loggedIn}">
                        <h:outputStylesheet library="css" name="#{facesContext.externalContext.requestLocale.language}-userMainMenu.css" />
                        <ul>
                            <c:if test="#{userManager.admin}">
                                <li><a href="#{request.contextPath}/admin/main.jsf" class="users"></a></li>
                            </c:if>
                            <li>
                                <a href="#{request.contextPath}/user/project/list.jsf" class="projects"></a>
                            </li>
                            <li>
                                <a href="#{request.contextPath}/user/customer/list.jsf" class="customers"></a>
                            </li>
                            <li>
                                <a href="#{request.contextPath}/user/invoice/list.jsf" class="invoices"></a>
                            </li>
                            <!--<li><a href="#{request.contextPath}/user/report/list.jsf" class="reports"></a></li>-->
                        </ul>
                    </c:if>
                </div>
            </div>
        </div>

    </composite:implementation>
</html>
